﻿@model web.core.ViewModels.PageListProductViewModels
<div class="header-top-search-wrapper v-item">
        
        @{
            var url_search = "/tim_kiem.ub";
            }        
        <div class="form-search">
            <label for="search">Tìm kiếm:</label>
            <input id="text_search" class="input-text" type="text" value="" name="text_search" maxlength="128"></input>
            <button type="submit" title="Tìm kiếm" class="button" onclick="search_product();"><span><span>Tìm kiếm</span></span></button>
            <div id="search_autocomplete" class="search-autocomplete"></div>
        </div>
        <script type="text/javascript"> 
                $('#text_search').keypress(function (e) {
                    if (e.which == 13) {
                        search_product();
                    };
                    //or...
                    //if (e.which == 13) e.preventDefault();
                });
            });
            function search_product() {
                if (document.getElementById("text_search").value !== "") {
                    var te_se = document.getElementById("text_search").value;
                    te_se = te_se.replace(/(<([^>]+)>)/ig, "");
                    window.location.href = "@url_search?search=" + te_se;
                }

            }
            
        </script>
</div>